#encoding: utf-8
from django.db import models

class CourseCategory(models.Model):
    name = models.CharField(max_length=100)

class Teacher(models.Model):
    username = models.CharField(max_length=100)
    # 头像
    avatar = models.URLField()
    jobTitle = models.CharField(max_length=100)
    # 简介
    profile = models.TextField()

class Course(models.Model):
    title = models.CharField(max_length=100)
    category = models.ForeignKey('CourseCategory',on_delete=models.DO_NOTHING)
    teacher = models.ForeignKey("Teacher",on_delete=models.DO_NOTHING)
    video_url = models.URLField()
    # 封面图
    cover_url = models.URLField()
    price = models.FloatField()
    # 时长,单位是秒
    duration = models.IntegerField()
    # 简介
    profile = models.TextField()
    pub_time = models.DateTimeField(auto_now_add=True)
